package com.gitee.wsl.mathematics.geometry.d2.rect.ext

import com.gitee.wsl.mathematics.geometry.d2.rect.Rectangle
import com.gitee.wsl.mathematics.interpolator.Ratio
import com.gitee.wsl.mathematics.interpolator.ext.interpolate

fun Rectangle.Companion.interpolated(a: Rectangle, b: Rectangle, ratio: Ratio): Rectangle = Rectangle(
    ratio.interpolate(a.left, b.left),
    ratio.interpolate(a.top, b.top),
    ratio.interpolate(a.right, b.right),
    ratio.interpolate(a.bottom, b.bottom),
)